home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Technology Seed / Jan. '98 ATS.toast / QuickTime™ 3.0b11 / QTPublicInterfaces / CIncludes / Dialogs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-12  |  18.5 KB  |  567 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Dialogs.h
  3.  
  4.      Contains:    Dialog Manager interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 3.0 Beta
  8.  
  9.      Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __DIALOGS__
  19. #define __DIALOGS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27. #ifndef __EVENTS__
  28. #include <Events.h>
  29. #endif
  30. #ifndef __MACWINDOWS__
  31. #include <MacWindows.h>
  32. #endif
  33. #ifndef __TEXTEDIT__
  34. #include <TextEdit.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59.  
  60. enum {
  61.                                                                 /* new, more standard names for dialog item types*/
  62.     kControlDialogItem            = 4,
  63.     kButtonDialogItem            = kControlDialogItem | 0,
  64.     kCheckBoxDialogItem            = kControlDialogItem | 1,
  65.     kRadioButtonDialogItem        = kControlDialogItem | 2,
  66.     kResourceControlDialogItem    = kControlDialogItem | 3,
  67.     kStaticTextDialogItem        = 8,
  68.     kEditTextDialogItem            = 16,
  69.     kIconDialogItem                = 32,
  70.     kPictureDialogItem            = 64,
  71.     kUserDialogItem                = 0,
  72.     kItemDisableBit                = 128
  73. };
  74.  
  75.  
  76. enum {
  77.                                                                 /* old names for dialog item types*/
  78.     ctrlItem                    = 4,
  79.     btnCtrl                        = 0,
  80.     chkCtrl                        = 1,
  81.     radCtrl                        = 2,
  82.     resCtrl                        = 3,
  83.     statText                    = 8,
  84.     editText                    = 16,
  85.     iconItem                    = 32,
  86.     picItem                        = 64,
  87.     userItem                    = 0,
  88.     itemDisable                    = 128
  89. };
  90.  
  91.  
  92. enum {
  93.                                                                 /* standard dialog item numbers*/
  94.     kStdOkItemIndex                = 1,
  95.     kStdCancelItemIndex            = 2,                            /* old names*/
  96.     ok                            = kStdOkItemIndex,
  97.     cancel                        = kStdCancelItemIndex
  98. };
  99.  
  100.  
  101. enum {
  102.                                                                 /* standard icon resource id's     */
  103.     kStopIcon                    = 0,
  104.     kNoteIcon                    = 1,
  105.     kCautionIcon                = 2,                            /* old names*/
  106.     stopIcon                    = kStopIcon,
  107.     noteIcon                    = kNoteIcon,
  108.     cautionIcon                    = kCautionIcon
  109. };
  110.  
  111.  
  112.  
  113. #if OLDROUTINENAMES
  114. /*
  115.    These constants lived briefly on ETO 16.  They suggest
  116.    that there is only one index you can use for the OK 
  117.    item, which is not true.  You can put the ok item 
  118.    anywhere you want in the DITL.
  119. */
  120.  
  121. enum {
  122.     kOkItemIndex                = 1,
  123.     kCancelItemIndex            = 2
  124. };
  125.  
  126. #endif  /* OLDROUTINENAMES */
  127.  
  128. /*    Dialog Item List Manipulation Constants    */
  129. typedef SInt16                             DITLMethod;
  130.  
  131. enum {
  132.     overlayDITL                    = 0,
  133.     appendDITLRight                = 1,
  134.     appendDITLBottom            = 2
  135. };
  136.  
  137. typedef SInt16                             StageList;
  138. /* DialogRef is obsolete. Use DialogPtr instead.*/
  139. typedef DialogPtr                         DialogRef;
  140.  
  141. struct DialogRecord {
  142.     WindowRecord                     window;
  143.     Handle                             items;
  144.     TEHandle                         textH;
  145.     SInt16                             editField;
  146.     SInt16                             editOpen;
  147.     SInt16                             aDefItem;
  148. };
  149. typedef struct DialogRecord                DialogRecord;
  150.  
  151. typedef DialogRecord *                    DialogPeek;
  152.  
  153. struct DialogTemplate {
  154.     Rect                             boundsRect;
  155.     SInt16                             procID;
  156.     Boolean                         visible;
  157.     Boolean                         filler1;
  158.     Boolean                         goAwayFlag;
  159.     Boolean                         filler2;
  160.     SInt32                             refCon;
  161.     SInt16                             itemsID;
  162.     Str255                             title;
  163. };
  164. typedef struct DialogTemplate            DialogTemplate;
  165.  
  166. typedef DialogTemplate *                DialogTPtr;
  167. typedef DialogTPtr *                    DialogTHndl;
  168.  
  169. struct AlertTemplate {
  170.     Rect                             boundsRect;
  171.     SInt16                             itemsID;
  172.     StageList                         stages;
  173. };
  174. typedef struct AlertTemplate            AlertTemplate;
  175.  
  176. typedef AlertTemplate *                    AlertTPtr;
  177. typedef AlertTPtr *                        AlertTHndl;
  178. /* new type abstractions for the dialog manager */
  179. typedef SInt16                             DialogItemIndexZeroBased;
  180. typedef SInt16                             DialogItemIndex;
  181. typedef SInt16                             DialogItemType;
  182. /* dialog manager callbacks */
  183. typedef CALLBACK_API( void , SoundProcPtr )(SInt16 soundNumber);
  184. typedef CALLBACK_API( Boolean , ModalFilterProcPtr )(DialogPtr theDialog, EventRecord *theEvent, DialogItemIndex *itemHit);
  185. typedef CALLBACK_API( void , UserItemProcPtr )(WindowPtr theWindow, DialogItemIndex itemNo);
  186. typedef STACK_UPP_TYPE(SoundProcPtr)                             SoundUPP;
  187. typedef STACK_UPP_TYPE(ModalFilterProcPtr)                         ModalFilterUPP;
  188. typedef STACK_UPP_TYPE(UserItemProcPtr)                         UserItemUPP;
  189. enum { uppSoundProcInfo = 0x00000080 };                         /* pascal no_return_value Func(2_bytes) */
  190. enum { uppModalFilterProcInfo = 0x00000FD0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  191. enum { uppUserItemProcInfo = 0x000002C0 };                         /* pascal no_return_value Func(4_bytes, 2_bytes) */
  192. #define NewSoundProc(userRoutine)                                 (SoundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundProcInfo, GetCurrentArchitecture())
  193. #define NewModalFilterProc(userRoutine)                         (ModalFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppModalFilterProcInfo, GetCurrentArchitecture())
  194. #define NewUserItemProc(userRoutine)                             (UserItemUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppUserItemProcInfo, GetCurrentArchitecture())
  195. #define CallSoundProc(userRoutine, soundNumber)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppSoundProcInfo, (soundNumber))
  196. #define CallModalFilterProc(userRoutine, theDialog, theEvent, itemHit)  CALL_THREE_PARAMETER_UPP((userRoutine), uppModalFilterProcInfo, (theDialog), (theEvent), (itemHit))
  197. #define CallUserItemProc(userRoutine, theWindow, itemNo)         CALL_TWO_PARAMETER_UPP((userRoutine), uppUserItemProcInfo, (theWindow), (itemNo))
  198. #if !TARGET_OS_MAC
  199.  
  200. typedef void (*ModelessCallbackProcPtr)(EventRecord *theEvent, DialogRef theDialog, DialogItemIndex itemHit);
  201. typedef ModelessCallbackProcPtr ModelessCallbackUPP;
  202. EXTERN_API (void) SetModelessDialogCallbackProc(DialogRef theDialog, ModelessCallbackUPP callbackProc);
  203. EXTERN_API (OSErr) GetDialogControlNotificationProc(void *theProc); 
  204. EXTERN_API (void) SetDialogMovableModal(DialogRef theDialog); 
  205.  
  206. #endif  /*  !TARGET_OS_MAC */
  207.  
  208.  
  209. /*
  210.     NOTE: Code running under MultiFinder or System 7.0 or newer
  211.     should always pass NULL to InitDialogs.
  212. */
  213. EXTERN_API( void )
  214. InitDialogs                        (void *                    ignored)                            ONEWORDINLINE(0xA97B);
  215.  
  216. EXTERN_API( void )
  217. ErrorSound                        (SoundUPP                 soundProc)                            ONEWORDINLINE(0xA98C);
  218.  
  219. EXTERN_API( DialogPtr )
  220. NewDialog                        (void *                    dStorage,
  221.                                  const Rect *            boundsRect,
  222.                                  ConstStr255Param         title,
  223.                                  Boolean                 visible,
  224.                                  SInt16                 procID,
  225.                                  WindowPtr                 behind,
  226.                                  Boolean                 goAwayFlag,
  227.                                  SInt32                 refCon,
  228.                                  Handle                 items)                                ONEWORDINLINE(0xA97D);
  229.  
  230. EXTERN_API( DialogPtr )
  231. GetNewDialog                    (SInt16                 dialogID,
  232.                                  void *                    dStorage,
  233.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA97C);
  234.  
  235. EXTERN_API( DialogPtr )
  236. NewColorDialog                    (void *                    dStorage,
  237.                                  const Rect *            boundsRect,
  238.                                  ConstStr255Param         title,
  239.                                  Boolean                 visible,
  240.                                  SInt16                 procID,
  241.                                  WindowPtr                 behind,
  242.                                  Boolean                 goAwayFlag,
  243.                                  SInt32                 refCon,
  244.                                  Handle                 items)                                ONEWORDINLINE(0xAA4B);
  245.  
  246. EXTERN_API( void )
  247. CloseDialog                        (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA982);
  248.  
  249. EXTERN_API( void )
  250. DisposeDialog                    (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA983);
  251.  
  252. EXTERN_API( void )
  253. ModalDialog                        (ModalFilterUPP         modalFilter,
  254.                                  DialogItemIndex *        itemHit)                            ONEWORDINLINE(0xA991);
  255.  
  256. EXTERN_API( Boolean )
  257. IsDialogEvent                    (const EventRecord *    theEvent)                            ONEWORDINLINE(0xA97F);
  258.  
  259. EXTERN_API( Boolean )
  260. DialogSelect                    (const EventRecord *    theEvent,
  261.                                  DialogPtr *            theDialog,
  262.                                  DialogItemIndex *        itemHit)                            ONEWORDINLINE(0xA980);
  263.  
  264. EXTERN_API( void )
  265. DrawDialog                        (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA981);
  266.  
  267. EXTERN_API( void )
  268. UpdateDialog                    (DialogPtr                 theDialog,
  269.                                  RgnHandle                 updateRgn)                            ONEWORDINLINE(0xA978);
  270.  
  271. EXTERN_API( void )
  272. HideDialogItem                    (DialogPtr                 theDialog,
  273.                                  DialogItemIndex         itemNo)                                ONEWORDINLINE(0xA827);
  274.  
  275. EXTERN_API( void )
  276. ShowDialogItem                    (DialogPtr                 theDialog,
  277.                                  DialogItemIndex         itemNo)                                ONEWORDINLINE(0xA828);
  278.  
  279. EXTERN_API( DialogItemIndexZeroBased )
  280. FindDialogItem                    (DialogPtr                 theDialog,
  281.                                  Point                     thePt)                                ONEWORDINLINE(0xA984);
  282.  
  283. EXTERN_API( void )
  284. DialogCut                        (DialogPtr                 theDialog);
  285.  
  286. EXTERN_API( void )
  287. DialogPaste                        (DialogPtr                 theDialog);
  288.  
  289. EXTERN_API( void )
  290. DialogCopy                        (DialogPtr                 theDialog);
  291.  
  292. EXTERN_API( void )
  293. DialogDelete                    (DialogPtr                 theDialog);
  294.  
  295. EXTERN_API( DialogItemIndex )
  296. Alert                            (SInt16                 alertID,
  297.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA985);
  298.  
  299. EXTERN_API( DialogItemIndex )
  300. StopAlert                        (SInt16                 alertID,
  301.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA986);
  302.  
  303. EXTERN_API( DialogItemIndex )
  304. NoteAlert                        (SInt16                 alertID,
  305.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA987);
  306.  
  307. EXTERN_API( DialogItemIndex )
  308. CautionAlert                    (SInt16                 alertID,
  309.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA988);
  310.  
  311. EXTERN_API( void )
  312. GetDialogItem                    (DialogPtr                 theDialog,
  313.                                  DialogItemIndex         itemNo,
  314.                                  DialogItemType *        itemType,
  315.                                  Handle *                item,
  316.                                  Rect *                    box)                                ONEWORDINLINE(0xA98D);
  317.  
  318. EXTERN_API( void )
  319. SetDialogItem                    (DialogPtr                 theDialog,
  320.                                  DialogItemIndex         itemNo,
  321.                                  DialogItemType         itemType,
  322.                                  Handle                 item,
  323.                                  const Rect *            box)                                ONEWORDINLINE(0xA98E);
  324.  
  325. EXTERN_API( void )
  326. ParamText                        (ConstStr255Param         param0,
  327.                                  ConstStr255Param         param1,
  328.                                  ConstStr255Param         param2,
  329.                                  ConstStr255Param         param3)                                ONEWORDINLINE(0xA98B);
  330.  
  331. EXTERN_API( void )
  332. SelectDialogItemText            (DialogPtr                 theDialog,
  333.                                  DialogItemIndex         itemNo,
  334.                                  SInt16                 strtSel,
  335.                                  SInt16                 endSel)                                ONEWORDINLINE(0xA97E);
  336.  
  337. EXTERN_API( void )
  338. GetDialogItemText                (Handle                 item,
  339.                                  Str255                 text)                                ONEWORDINLINE(0xA990);
  340.  
  341. EXTERN_API( void )
  342. SetDialogItemText                (Handle                 item,
  343.                                  ConstStr255Param         text)                                ONEWORDINLINE(0xA98F);
  344.  
  345. EXTERN_API( SInt16 )
  346. GetAlertStage                    (void)                                                        TWOWORDINLINE(0x3EB8, 0x0A9A);
  347.  
  348. EXTERN_API( void )
  349. SetDialogFont                    (SInt16                 value)                                TWOWORDINLINE(0x31DF, 0x0AFA);
  350.  
  351. EXTERN_API( void )
  352. ResetAlertStage                    (void)                                                        TWOWORDINLINE(0x4278, 0x0A9A);
  353.  
  354.  
  355. #if CGLUESUPPORTED
  356. EXTERN_API_C( DialogPtr )
  357. newdialog                        (void *                    dStorage,
  358.                                  const Rect *            boundsRect,
  359.                                  const char *            title,
  360.                                  Boolean                 visible,
  361.                                  SInt16                 procID,
  362.                                  WindowPtr                 behind,
  363.                                  Boolean                 goAwayFlag,
  364.                                  SInt32                 refCon,
  365.                                  Handle                 items);
  366.  
  367. EXTERN_API_C( DialogPtr )
  368. newcolordialog                    (void *                    dStorage,
  369.                                  const Rect *            boundsRect,
  370.                                  const char *            title,
  371.                                  Boolean                 visible,
  372.                                  SInt16                 procID,
  373.                                  WindowPtr                 behind,
  374.                                  Boolean                 goAwayFlag,
  375.                                  SInt32                 refCon,
  376.                                  Handle                 items);
  377.  
  378. EXTERN_API_C( void )
  379. paramtext                        (const char *            param0,
  380.                                  const char *            param1,
  381.                                  const char *            param2,
  382.                                  const char *            param3);
  383.  
  384. EXTERN_API_C( void )
  385. getdialogitemtext                (Handle                 item,
  386.                                  char *                    text);
  387.  
  388. EXTERN_API_C( void )
  389. setdialogitemtext                (Handle                 item,
  390.                                  const char *            text);
  391.  
  392. EXTERN_API_C( DialogItemIndexZeroBased )
  393. finddialogitem                    (DialogPtr                 theDialog,
  394.                                  Point *                thePt);
  395.  
  396. #endif  /* CGLUESUPPORTED */
  397.  
  398. EXTERN_API( void )
  399. AppendDITL                        (DialogPtr                 theDialog,
  400.                                  Handle                 theHandle,
  401.                                  DITLMethod             method);
  402.  
  403. EXTERN_API( DialogItemIndex )
  404. CountDITL                        (DialogPtr                 theDialog);
  405.  
  406. EXTERN_API( void )
  407. ShortenDITL                        (DialogPtr                 theDialog,
  408.                                  DialogItemIndex         numberItems);
  409.  
  410. EXTERN_API( Boolean )
  411. StdFilterProc                    (DialogPtr                 theDialog,
  412.                                  EventRecord *            event,
  413.                                  DialogItemIndex *        itemHit);
  414.  
  415. EXTERN_API( OSErr )
  416. GetStdFilterProc                (ModalFilterUPP *        theProc)                            THREEWORDINLINE(0x303C, 0x0203, 0xAA68);
  417.  
  418. EXTERN_API( OSErr )
  419. SetDialogDefaultItem            (DialogPtr                 theDialog,
  420.                                  DialogItemIndex         newItem)                            THREEWORDINLINE(0x303C, 0x0304, 0xAA68);
  421.  
  422. EXTERN_API( OSErr )
  423. SetDialogCancelItem                (DialogPtr                 theDialog,
  424.                                  DialogItemIndex         newItem)                            THREEWORDINLINE(0x303C, 0x0305, 0xAA68);
  425.  
  426. EXTERN_API( OSErr )
  427. SetDialogTracksCursor            (DialogPtr                 theDialog,
  428.                                  Boolean                 tracks)                                THREEWORDINLINE(0x303C, 0x0306, 0xAA68);
  429.  
  430. #if OLDROUTINENAMES
  431. #define DisposDialog(theDialog) DisposeDialog(theDialog)
  432. #define UpdtDialog(theDialog, updateRgn) UpdateDialog(theDialog, updateRgn)
  433. #define GetDItem(theDialog, itemNo, itemType, item, box) GetDialogItem(theDialog, itemNo, itemType, item, box)
  434. #define SetDItem(theDialog, itemNo, itemType, item, box) SetDialogItem(theDialog, itemNo, itemType, item, box)
  435. #define HideDItem(theDialog, itemNo) HideDialogItem(theDialog, itemNo)
  436. #define ShowDItem(theDialog, itemNo) ShowDialogItem(theDialog, itemNo)
  437. #define SelIText(theDialog, itemNo, strtSel, endSel) SelectDialogItemText(theDialog, itemNo, strtSel, endSel)
  438. #define GetIText(item, text) GetDialogItemText(item, text)
  439. #define SetIText(item, text) SetDialogItemText(item, text)
  440. #define FindDItem(theDialog, thePt) FindDialogItem(theDialog, thePt)
  441. #define NewCDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) \
  442. NewColorDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  443. #define GetAlrtStage() GetAlertStage()
  444. #define ResetAlrtStage() ResetAlertStage()
  445. #define DlgCut(theDialog) DialogCut(theDialog)
  446. #define DlgPaste(theDialog) DialogPaste(theDialog)
  447. #define DlgCopy(theDialog) DialogCopy(theDialog)
  448. #define DlgDelete(theDialog) DialogDelete(theDialog)
  449. #define SetDAFont(fontNum) SetDialogFont(fontNum)
  450. #if CGLUESUPPORTED
  451. #define newcdialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) \
  452. newcolordialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  453. #define getitext(item, text) getdialogitemtext(item, text)
  454. #define setitext(item, text) setdialogitemtext(item, text)
  455. #define findditem(theDialog, thePt) finddialogitem(theDialog, thePt)
  456. #endif  /* CGLUESUPPORTED */
  457.  
  458. #endif  /* OLDROUTINENAMES */
  459.  
  460. /*
  461.     *****************************************************************************
  462.     *                                                                           *
  463.     * The conditional STRICT_DIALOGS has been removed from this interface file. *
  464.     * The accessor macros to a DialogRecord are no longer necessary.            *
  465.     *                                                                           *
  466.     * All ≈Ref Types have reverted to their original Handle and Ptr Types.      *
  467.     *                                                                           *
  468.     *****************************************************************************
  469.  
  470.     Details:
  471.     The original purpose of the STRICT_ conditionals and accessor macros was to
  472.     help ease the transition to Copland.  Shared data structures are difficult
  473.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  474.     WindowRecord and other data structures, we would begin the migration to the
  475.     discipline wherein system data structures are completely hidden from
  476.     applications.
  477.     
  478.     After many design reviews, we finally concluded that with this sort of
  479.     migration, the system could never tell when an application was no longer
  480.     peeking at a WindowRecord, and thus the data structure might never become
  481.     system owned.  Additionally, there were many other limitations in the
  482.     classic toolbox that were begging to be addressed.  The final decision was
  483.     to leave the traditional toolbox as a compatibility mode.
  484.     
  485.     We also decided to use the Handle and Ptr based types in the function
  486.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  487.     WindowRef.  The Ref types are still defined in the header files, so all
  488.     existing code will still compile exactly as it did before.  There are
  489.     several reasons why we chose to do this:
  490.     
  491.     - The importance of backwards compatibility makes it unfeasible for us to
  492.     enforce real opaque references in the implementation anytime in the
  493.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  494.     ControlRef, etc.) in the documentation and header files would always be a
  495.     fake veneer of opacity.
  496.     
  497.     - There exists a significant base of books and sample code that neophyte
  498.     Macintosh developers use to learn how to program the Macintosh.  These
  499.     books and sample code all use direct data access.  Introducing opaque data
  500.     types at this point would confuse neophyte programmers more than it would
  501.     help them.
  502.     
  503.     - Direct data structure access is used by nearly all Macintosh developers. 
  504.     Changing the interfaces to reflect a false opacity would not provide any
  505.     benefit to these developers.
  506.     
  507.     - Accessor functions are useful in and of themselves as convenience
  508.     functions, without being tied to opaque data types.  We will complete and
  509.     document the Windows and Dialogs accessor functions in an upcoming release
  510.     of the interfaces.
  511. */
  512. #ifdef __cplusplus
  513. inline WindowPtr     GetDialogWindow(DialogPtr dialog)        { return (WindowPtr) dialog;                         }
  514. inline SInt16        GetDialogDefaultItem(DialogPtr dialog)  { return (*(SInt16 *) (((UInt8 *) dialog) + 168));    }
  515. inline SInt16        GetDialogCancelItem(DialogPtr dialog)     { return (*(SInt16 *) (((UInt8 *) dialog) + 166));    }
  516. inline SInt16        GetDialogKeyboardFocusItem(DialogPtr dialog)    { return ((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1); }
  517. inline void        SetGrafPortOfDialog(DialogPtr dialog) { MacSetPort ((GrafPtr) dialog); }
  518. #else
  519. #define GetDialogWindow(dialog)    ((WindowPtr) dialog)
  520. #define GetDialogDefaultItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 168))
  521. #define GetDialogCancelItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 166))
  522. #define GetDialogKeyboardFocusItem(dialog) ((SInt16)(*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1)
  523. #define SetGrafPortOfDialog(dialog) do { MacSetPort ((GrafPtr) dialog); } while (false)
  524. #endif
  525.  
  526.  
  527. EXTERN_API( void )
  528. CouldDialog                        (SInt16                 dialogID)                            ONEWORDINLINE(0xA979);
  529.  
  530. EXTERN_API( void )
  531. FreeDialog                        (SInt16                 dialogID)                            ONEWORDINLINE(0xA97A);
  532.  
  533. EXTERN_API( void )
  534. CouldAlert                        (SInt16                 alertID)                            ONEWORDINLINE(0xA989);
  535.  
  536. EXTERN_API( void )
  537. FreeAlert                        (SInt16                 alertID)                            ONEWORDINLINE(0xA98A);
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547. #if PRAGMA_STRUCT_ALIGN
  548.     #pragma options align=reset
  549. #elif PRAGMA_STRUCT_PACKPUSH
  550.     #pragma pack(pop)
  551. #elif PRAGMA_STRUCT_PACK
  552.     #pragma pack()
  553. #endif
  554.  
  555. #ifdef PRAGMA_IMPORT_OFF
  556. #pragma import off
  557. #elif PRAGMA_IMPORT
  558. #pragma import reset
  559. #endif
  560.  
  561. #ifdef __cplusplus
  562. }
  563. #endif
  564.  
  565. #endif /* __DIALOGS__ */
  566.  
  567.